<extend name="Public/base" />

<block name="body">
	 
	<div class="main-title">
		<h2>圈子列表</h2>
	</div>
	<div> </div>
	<br/>
	<div class="cf">
		<div class="fl">
            <a title="新增" class="btn btn-primary" href="{:U('add')}"><i class="glyphicon glyphicon-plus"></i></a>             
        </div>

        <!-- 高级搜索 -->
		<div class="search-form fr cf">
			 
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="table table-bordered">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
        <th class="">ID</th>
        <th class="">名称</th>
		<th class="">ICON</th>
		<th class="">背景</th>
        <th class="">描述</th>
        <th class="">关注</th>
		<th class="">帖子数</th>
		<th width="300" class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td width="1%"><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
            <td>
                {$vo.id}
            </td>
			<td>
                {$vo.name}
            </td>
            <td>
                <div class="upload-img-box">
                <notempty name="vo.icon">
                    <div class="upload-pre-item"><img src="{:url_format($vo['icon'])}"/></div>
                </notempty>
                </div>
            </td>
            <td>
                <div class="upload-img-box">
                <notempty name="vo.background">
                    <div class="upload-pre-item"><img src="{:url_format($vo['background'])}"/></div>
                </notempty>
                </div>
            </td>
            <td>
                {$vo.description}
            </td>
            <td>
                {$vo.subscribe_count|default=0}
            </td>
            <td>
                {$vo.threads_count|default=0}
            </td>
			<td>
				<a class="btn btn-default btn-xs" title="编辑" href="{:U('edit?id='.$vo['id'])}"><i class="glyphicon glyphicon-pencil"></i></a>
                <a class="btn btn-default btn-xs" title="帖子列表" href="{:U('Threads/index?circle_id='.$vo['id'])}"><i class="glyphicon glyphicon-th-list"></i> 帖子</a>
                <a class="btn btn-default btn-xs" title="管理员" href="{:U('CircleModerators/index?circle_id='.$vo['id'])}"><i class="glyphicon glyphicon-user" style="color: #44ff00"></i> 版主</a>
                <a class="btn btn-default btn-xs" title="禁言" href="{:U('CircleBan/index?circle_id='.$vo['id'])}"><i class="glyphicon glyphicon-user" style="color: red"></i> 禁言</a>
            </td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
    <div id="video-pre">
        <video controls="controls" autoplay="autoplay"></video>
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');

        var game  = $('.search-form').find('select').serialize();
        game = game.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        game = game.replace(/^&/g,'');

        if( url.indexOf('?')>0 ){
            url += '&' + query + '&' + game;
        }else{
            url += '?' + query + '&' + game;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('index')}');
     
	</script>
</block>
